<template>
   <h2>父级组件</h2>
   <button @click="isShow=!isShow">切换显示子组件</button>
   <hr>
   <Child2  v-if="isShow" />
  </template>

<script lang="ts">
    import Child2 from './components/child2.vue'
    import {
        reactive,
        ref,
        defineComponent,
        computed,
        watch,
        watchEffect
    } from 'vue'

    export default defineComponent({
        name: 'App',
        //注册组件
        components: {
            Child2
        },
        setup() {
            const isShow = ref(true)
            return {
                isShow
            }
        }
    })
</script>